import request from '@/utils/request'
/**
 * @param {Object} user 用户的账号密码信息
 */
export const login = (user) => {
  return request.post('login', user)
}
/**
 * @author 丁凯
 */
export const getBlogList = (query) => {
  return request.get('blog', {
    params: query
  })
}
/**
 * @author 丁凯
 * @param {int} id 查询博客的id
 */
export const selectBlogById = id => {
  return request.get(`blog/${id}`)
}
/**
 * @author 丁凯
 * @param {int} id 博客id
 * @param {object} blog 博客信息
 * @description 修改博客信息
 */
export const updateBlog = (id, blog) => {
  return request.put(`blog/${id}`, blog)
}
/**
 * @author丁凯
 * @param {object} blog 新增博客信息
 * @description 添加博客
 */
export const createBlog = blog => {
  return request.post('blog', blog)
}
/**
 * @author 丁凯
 * @param {int} id 删除博客的id
 */
export const deleteBlog = id => {
  return request.delete(`blog/${id}`)
}
